<?php echo script::add('jquery'), script::add('thickbox'); ?>
<script type="text/javascript">$(document).ready(function(){$('#submit_button_id').click(function(){var term_name=$('#term_name_box').val();if(term_name==''){alert('分类名不能为空!');$('#term_name_box').focus();return false;}$.post('<?php echo $this->get_action_url('ajax_insert_term'); ?>', {term_name:term_name,term_note:$('#term_note_box').val()}, function(data){switch(data){case '101':alert('恭喜!操作成功');$('#term_name_box').val('');$('#term_note_box').val('');location.reload();break;case '100':alert('对不起,操作失败!请重新操作');break;case '103':alert('对不起,所添加的分类已存在!');break;default:alert(data);}});});});function delete_term(id){$.post('<?php echo $this->get_action_url('ajax_delete_term'); ?>', {id:id}, function(data){switch(data){case '101':alert('恭喜!操作成功');location.reload();break; case '100':alert('对不起，操作失败!请重新操作');break}});}</script>
<table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" align="left">>><?php echo $site_name; ?></td>
      </tr>
      <tr>
        <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="30" align="left">分类列表：</td>
          </tr>
          <tr>
            <td align="left"><table width="100%" border="0" cellspacing="5" cellpadding="0">
              <tr bgcolor="#CCCCCC">
                <td width="45" height="30" align="center">序号</td>
                <td width="240" height="30" align="center">分类名称</td>
                <td width="270" height="30" align="center">分类注释</td>
                <td width="70" height="30" align="center">文章数</td>
                <td height="30" colspan="2" align="center">操作</td>
              </tr>
			  <?php if($list_data == true) {
			   foreach($list_data as $key=>$lines) {?>
              <tr>
                <td height="30" align="center"><?php echo $key + 1; ?>.</td>
                <td><?php echo $lines['name']; ?></td>
                <td><?php echo $lines['note']; ?></td>
                <td align="center"><?php echo $lines['num']; ?></td>
                <td width="70" align="center"><a href="<?php echo $this->get_action_url('ajax_tb_edit_term'); ?>/?width=420&height=160&id=<?php echo $lines['id']; ?>" class="thickbox" title="编辑分类">编辑</a></td>
                <td width="70" align="center"><?php if($lines['num'] > 0) { ?>删除<?php } else { ?><a href="javascript:void(0);" onclick="delete_term(<?php echo $lines['id']; ?>)">删除</a><?php } ?></td>
              </tr>
			  <?php } } else { ?>
			   <tr>
                <td height="30" colspan="6" align="center">暂无数据</td>
              </tr>
			  <?php }?>
            </table></td>
          </tr>
          <tr>
            <td height="30" align="left">添加新分类：</td>
          </tr>
          <tr>
            <td align="left"><table width="100%" border="0" cellspacing="5" cellpadding="0">
              <tr>
                <td width="100" height="30" align="right">分类名称：</td>
                <td align="left"><input type="text" name="class_name" id="term_name_box"/></td>
              </tr>
              <tr>
                <td width="100" height="60" align="right">分数注释：</td>
                <td align="left"><textarea name="term_note" id="term_note_box"></textarea></td>
              </tr>
              <tr>
                <td width="100" height="30" align="right">&nbsp;</td>
                <td align="left"><input type="button" name="submit_button" id="submit_button_id" value="添加"/></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
</table>